<!--
 * @Author: Zhouxin 2201_75539691@noreply.gitcode.com
 * @Date: 2024-12-11 22:05:53
 * @LastEditors: Zhouxin 2201_75539691@noreply.gitcode.com
 * @LastEditTime: 2024-12-12 00:45:33
 * @FilePath: \2024.12.11-day15-执行上下文 内置对象方法 sp.7z\test4.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function test() {
            var foo;
            function bar() {
                console.log("this will run!");
            }
            foo(); // 未捕获类型错误“foo不是函数”
            bar(); // "this will run!"
            foo = function () {
                console.log("this won't run!");
            };
        }
        test();
    </script>
</body>

</html>